<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Admin\AdminController;
use App\Http\Controllers\Admin\AwardController;
use App\Http\Controllers\Admin\AwardItemController;
use App\Http\Middleware\AdminAuth;

Route::prefix('auth')->group(function () {
    Route::post('/register', [AdminController::class, 'register']);
    Route::post('/login', [AdminController::class, 'login']);
});

Route::middleware([AdminAuth::class])->group(function () {
    Route::prefix('award')->group(function () {
        Route::get('/list', [AwardController::class, 'list']);
        Route::post('/edit/{id}', [AwardController::class, 'edit'])->where('id', '[0-9]+');
        Route::get('/{id}', [AwardController::class, 'detail'])->where('id', '[0-9]+');
        Route::get('/search', [AwardController::class, 'search']);
    });

    Route::prefix('auth')->group(function () {
        Route::post('/logout', [AdminController::class, 'logout']);
    });

    Route::prefix('awarditem')->group(function () {
        Route::get('/list', [AwardItemController::class, 'list']);
        Route::post('/edit/{id}', [AwardItemController::class, 'edit'])->where('id', '[0-9]+');
        Route::get('/{id}', [AwardItemController::class, 'detail'])->where('id', '[0-9]+');
    });
});

